from command import Command

__all__ = [
    "HotTub", "HotTubOnCommand", "HotTubOffCommand"
]

class HotTub:
    def __init__(self):
        self._on = False
        self._temperature = 0

    def on(self):
        self._on = True

    def off(self):
        self._on = False

    def circulate(self):
        if self._on:
            print("Hot tub is bubbling")

    def jets_on(self):
        if self._on:
            print("Hot tub jets are on")

    def jets_off(self):
        if self._on:
            print("Hot tub jets are off")

    def set_temperature(self, temperature: int):
        if temperature > self._temperature:
            print(f"Hot tub is heating to a steaming {temperature}")
        else:
            print(f"Hot tub is cooling to {temperature} degrees")
        self._temperature = temperature


class HotTubOnCommand(Command):
    def __init__(self, hot_tub: HotTub):
        self._hot_tub = hot_tub

    def execute(self):
        self._hot_tub.on()
        self._hot_tub.set_temperature(104)
        self._hot_tub.circulate()

    def undo(self):
        self._hot_tub.off()


class HotTubOffCommand(Command):
    def __init__(self, hot_tub: HotTub):
        self._hot_tub = hot_tub

    def execute(self):
        self._hot_tub.set_temperature(98)
        self._hot_tub.off()

    def undo(self):
        self._hot_tub.on()